<?php

	/**
	* @framework : My Framework
	*
	* @author: fatangel26@gmail.com
	*
	*/

	class search_controller extends my_controller
	{
		public function __construct()
        {
            parent::__construct();

        }

        public function index()
        {

            if(isset($_POST['q']) && isset($_POST['s']))
			{
				$data['keyword'] = $_POST['q'];

				$search = array(
                    'keywords'  => $_POST['q'],
					'menu'      => $_POST['s'],
				);

				$this->_model 			  = new model_product();

				$this->_data['title'] 	  = 'Jewel | Tìm kiếm';

            	$this->_data['head_name'] = 'Tìm kiếm';

				$data['results'] 		  = $this->_model->search($search);

				$this->_helper 			  = new helper_text();

				$this->_data['content']   = $this->view("search/result", $data, TRUE);

			}
			else
			{
				$this->_data['title'] 	  = 'Jewel shop';
                $this->_data['head_name'] = "404";
                $this->_data['content']   = $this->view("errors/errors", $data='', TRUE);
			}

			$this->view("layout", $this->_data);
        }//End function index()

	}


    /* End of file search_controller.php */
	/* Location: .//D/root/my_framework/controllers/search_controller.php */


